#pragma once

BEGIN_NAMESPACE
//////////////////////////////////////////////////////////////////////////
bool wxIntersectRect(wxRect* dest, const wxRect* src1, const wxRect* src2);
bool wxPtInRect(const wxRect* rect, wxPoint point);
WXLPSTR wxCharNext(WXLPCSTR lpsz);

/////////////////////////////////////////////////////////////////////////////////////
//

class STRINGorID
{
public:
	STRINGorID(WXLPCSTR lpString) : m_lpstr(lpString)
	{ }
	STRINGorID(WXUINT nID) : m_lpstr(wxMAKEINTRESOURCE(nID))
	{ }
	WXLPCSTR m_lpstr;
};

/////////////////////////////////////////////////////////////////////////////////////
//

class LIBWXDUI_API CStdPtrArray
{
public:
	CStdPtrArray(int iPreallocSize = 0);
	CStdPtrArray(const CStdPtrArray& src);
	~CStdPtrArray();

	void Empty();
	void Resize(int iSize);
	bool IsEmpty() const;
	int Find(WXLPVOID iIndex) const;
	bool Add(WXLPVOID pData);
	bool SetAt(int iIndex, WXLPVOID pData);
	bool InsertAt(int iIndex, WXLPVOID pData);
	bool Remove(int iIndex);
	int GetSize() const;
	WXLPVOID* GetData();

	WXLPVOID GetAt(int iIndex) const;
	WXLPVOID operator[] (int nIndex) const;

protected:
	WXLPVOID* m_ppVoid;
	int m_nCount;
	int m_nAllocated;
};


/////////////////////////////////////////////////////////////////////////////////////
//

class LIBWXDUI_API CStdValArray
{
public:
	CStdValArray(int iElementSize, int iPreallocSize = 0);
	~CStdValArray();

	void Empty();
	bool IsEmpty() const;
	bool Add(WXLPVOID pData);
	bool Remove(int iIndex);
	int GetSize() const;
	WXLPVOID GetData();

	WXLPVOID GetAt(int iIndex) const;
	WXLPVOID operator[] (int nIndex) const;

protected:
	WXLPBYTE m_pVoid;
	int m_iElementSize;
	int m_nCount;
	int m_nAllocated;
};

/////////////////////////////////////////////////////////////////////////////////////
//

struct TITEM
{
	wxString Key;
	WXLPVOID Data;
	struct TITEM* pPrev;
	struct TITEM* pNext;
};

class LIBWXDUI_API CStdStringPtrMap
{
public:
	CStdStringPtrMap(int nSize = 83);
	~CStdStringPtrMap();

	void Resize(int nSize = 83);
	WXLPVOID Find(WXLPCSTR key, bool optimize = true) const;
	bool Insert(WXLPCSTR key, WXLPVOID pData);
	WXLPVOID Set(WXLPCSTR key, WXLPVOID pData);
	bool Remove(WXLPCSTR key);
	void RemoveAll();
	int GetSize() const;
	WXLPCSTR GetAt(int iIndex) const;
	WXLPCSTR operator[] (int nIndex) const;

protected:
	TITEM** m_aT;
	int m_nBuckets;
	int m_nCount;
};


END_NAMESPACE